<?php
class api{
        public $url ="http://hdong.matrojp.com/app/";
        public $test_url= "http://wdl.guangwei.info/app/";
        public $url_name;
        public $is_test = true;

        /**
         * curl post获取数据
         */

        function _post_url_post_data($data){
                if($this->is_test){
                        $url = $this->test_url."index.php?i=6&c=entry&do=".$this->url_name."&m=ml_auction";
                }else{
                        $url = $this->url."index.php?i=6&c=entry&do=".$this->url_name."&m=ml_auction";
                }

                echo $url."</br>";
                echo "<pre>";
                print_r($data);
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Access-Control-Allow-Credentials:true"));
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                // post数据
                curl_setopt($ch, CURLOPT_POST, 1);
                // post的变量
                curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                $output = curl_exec($ch);
                curl_close($ch);
                //$output = preg_replace("#\\\u([0-9a-f]+)#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", $output);
                echo $output;
        }
}
?>